module.exports = {
  transpileDependencies: ["webpack-dev-server/client"],
  chainWebpack: (config) => {
    config.entry.app = ["babel-polyfill", "./src/main.js"];
    if (process.env.NODE_ENV === "production") {
      if (config.has("externals")) {
        config.externals
          //.set("xe-utils", "XEUtils")
          .set("moment", "moment")
          .set("lodash", "lodash")
          .set("vcu", "vcu");
      } else {
        config.set("externals", {
          //"xe-utils": "XEUtils",
          moment: "moment",
          lodash: "lodash",
          vcu: "vcu",
        });
      }
    }
  },
  publicPath: "./",
  outputDir: "dist",
  assetsDir: "static",
  lintOnSave: false,
  css: {
    extract: ["production", "development"].includes(process.env.NODE_ENV),
    loaderOptions: {
      less: {
        javascriptEnabled: true,
      },
    },
  },
  configureWebpack: {
    optimization: {
      minimize: true,
    },
  },
};
